//
// Created by zzj on 2024/12/21.
//

#ifndef ANIMATIONUPDATEMANAGEMENT_SQLITEDAO_H
#define ANIMATIONUPDATEMANAGEMENT_SQLITEDAO_H

#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>

using tuple_record = std::tuple<int, float, QString, int, int, int, long long, long long, long long, long long, long
    long, long long, long long, QString>;

class SqliteDao final : public QObject {
    Q_OBJECT

public:
    SqliteDao() = default;

    ~SqliteDao() override;

    void InitDataBase();

    static void InitTable(const QString &videoTableName);

    static int QueryCount(const QString &sql);

    static QList<tuple_record> QueryRecords(const QString &sql);

    static bool Upgrade(const int id, const QString &tableName, const QString &fieldName, const QString &fieldValue);

private:
    QSqlDatabase db;
};


#endif //ANIMATIONUPDATEMANAGEMENT_SQLITEDAO_H
